<?php
$idPublicacao = $this->uri->segment(4);
$buscaPublicacao = $this->participantemodel->buscaPublicacao($idPublicacao)->row();

    $buscaParticipante = $this->participantemodel->buscaTodosParticipantes()->result();
    $buscaPublicacao2 = $this->participantemodel->buscaTodasPublicacoes()->result();

?>
 <div class="container">
     <br />    
     <span>
                            Seja bem vindo, 
                             <?=$this->session->userdata('usuario');?> |
                             <?=anchor(base_url()."administracao/principalcontroller/logout",'Sair','title="Logout"');?> |
                             <?=anchor(base_url()."administracao/areacontroller",'Voltar','title="Voltar"');
                             echo br(2);?>
                        </span>
            <div class="row">
                <div class="col-md-5">
                    <h2 class="section-title">Marcar Horário</h2>
                    <div class="panel panel-primary animated fadeInDown">
                        <div class="panel-heading">Formulário</div>
                        <div class="panel-body">
                           <?php $atributos_formulario = array('id'=>'exm1','role'=>'form','onsubmit'=>'PreventMultipleSubmit()');
                            echo form_open ("administracao/areacontroller/marcarHorarioApresentacao",$atributos_formulario);
                            echo form_hidden('id_publicacao', $idPublicacao);
                            if(validation_errors())
                            {   echo '<div class="alert alert-danger">
                                <button type="button" class="close " data-dismiss="alert">&times;</button>
                                <span>'.validation_errors().'</span>
                                </div>';
                            }
                             if($this->session->flashdata('msg')){?>
                                <div class="alert alert-success">
                                    <button type="button" class="close " data-dismiss="alert">&times;</button>
                                    <p><?=$this->session->flashdata('msg');?></p>
                                </div>
                             <?php
                            }?>
                                <div class="form-group">
                                    <?php echo form_label('Nome Completo');?>
                                    <sup>*</sup>
                                    <?php echo form_input(array('name'=>'nome', 'id'=>'nome','class'=>'form-control', 'type'=>'text', 'disabled'=>'disabled'), mb_strtoupper(set_value('id_participante', $buscaPublicacao->nome)));?>
                                    
                                 </div>
                            
                                  <div class="form-group">
                                    <?php echo form_label('Trabalho');?>
                                    <sup>*</sup>
                                    <?php echo form_input(array('name'=>'arquivo', 'id'=>'arquivo','class'=>'form-control', 'type'=>'text', 'disabled'=>'disabled'), mb_strtoupper(set_value('arquivo', $buscaPublicacao->arquivo)));?>
                                    
                                 </div>
                                <div class="form-group">
                                    <div class="input-group date" id="datetimepicker4">
                                    <?php echo form_label('Horário');?>
                                    <sup>*</sup>
                                    <?php 
                                    $atributosHorario = array(
                                        'name' => 'horario',
                                        'id' => 'horario',                                        
                                        'class'=>'form-control hora',
                                        'placeholder'=>'Digite o horário',
                                        'required'=>'required',
                                        'pattern'=> "^([0-1][0-9]|[2][0-3])(:([0-5][0-9])){1,2}$"
                                        );
                                        echo form_input($atributosHorario);?>                                   
                    
                                </div>
                                </div>
                             
           
                            
                                        <button type="submit" id="btSubmit" class="btn btn-primary pull-right">Enviar</button>
                                       
                                         <?php 
                                    $image_properties = array(
                                    'src' => 'img/loading.gif',
                                    'alt' => 'avatar',
                                    'class' => 'img-responsive imageborder x',
                                    'width' => '104',
                                    'height' => '45',
                                    'title' => '',
                                    'id' => 'carregando',                                    
                                    );                                    
                                    echo img($image_properties);?>
                                  
        
                            </form>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                	 <h2 class="section-title">Horários Programados</h2>
                        <div class="panel panel-primary">
                            <div class="panel-heading"><i class="fa fa-book"></i>Relações das Publicações Programadas </div>
                            <table class="table table-striped">
                                <thead>
                                            <tr>                                               
                                                <th>Nome do Participante</th>
                                                <th>Publicação</th>
                                                <th>Horário Apresentação</th>
                                               
                                                
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $contadorPublicacao = 0;
                                            
                                            foreach ($buscaPublicacao2 as $publicacoes)
                                            { 
                                               if($publicacoes->situacao_publicacao == 1 && $publicacoes->situacao_pagamento == 2)
                                               {    $contadorPublicacao++; ?>  
                                            <tr>
                                                <td><?=$publicacoes->nome;?></td>
                                                <td><?=$publicacoes->arquivo;?></td>
                                                <td><?=($publicacoes->horario_apresentacao != NULL)? $publicacoes->horario_apresentacao :"-";?></td>
                                            </tr>
                                            <?php
                                               }
                                               
                                               }
                                            ?>
                                           
                                          <tfoot>
                                            <tr>
                                                <td colspan="2">Total</td>
                                                <td ><?=$contadorPublicacao;?></td>
                                            </tr>
                                        </tfoot>
                                        </tbody>
                            </table>
                        </div>
                    </div>
            </div>
        </div> <!-- container  -->



